package com.yunduo.module.task;

import com.yunduo.service.PFileService;
import com.yunduo.service.ShopService;
/**
 * 删除店铺时的附带删除资源
 */
import java.util.List;
public class DeleteFileTask extends Thread {

    private PFileService pFileService; //服务
    private ShopService shopService;
    private String[] ids; //任务

    public DeleteFileTask(PFileService pFileService, ShopService shopService, String[] ids){
        this.shopService = shopService;
        this.pFileService = pFileService;
        this.ids = ids;
    }

    @Override
    public void run() {
        List<String> shopCovers = shopService.getShopCovers(ids);
        shopCovers.forEach(item->pFileService.removeByUrl(item));
    }
}
